<?PHP

	class tpl_create_room {
		
		public static function room_creation_denied(){
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				<<<EOV
<div style='margin: auto;'>
	<div class='form_container'><div class='row title'>{$GLOBALS['LANG']->lang_formcommon->information}</div><div class='row start'>{$GLOBALS['LANG']->lang_roommgmt->cannot_create_room}<br /><br /><a href='./index.php?act=roomlist{$GLOBALS['OUTPUT']->ses}'>{$GLOBALS['LANG']->lang_roommgmt->roomlist}</a></div></div><br />
</div>
EOV
.
				tpl_usercp::footer() .
				tpl_globals::footer(false);
		}
		
		public static function create_room_form($form){
					
			$form_html = tpl_form::printform($form);
			$submit = tpl_form::submitbutton($GLOBALS['LANG']->lang_misc->submit);
			$return = tpl_form::button($GLOBALS['LANG']->lang_roommgmt->roomlist,"document.location='./index.php?act=roomlist{$GLOBALS['OUTPUT']->ses}'");
			
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				<<<EOV
<div style='width: 400px; margin: auto;'>
	<form action='./index.php?act=create_room{$GLOBALS['OUTPUT']->ses}' method='post' accept-charset='UTF-8'>
	{$form_html}
	<div class='form_container'>
		<div class='row end'>
			{$submit} {$return}
		</div>
	</div>
	</form>
</div>
EOV
.
				tpl_usercp::footer() .
				tpl_globals::footer(false);
		}
		
		public static function room_created($rid,$name){
			$join_button = tpl_form::button($GLOBALS['LANG']->lang_roommgmt->join_room,"joinRoom();'",'joinroom');
			$roomlist_button = tpl_form::button($GLOBALS['LANG']->lang_roommgmt->roomlist,"document.location='./index.php?act=roomlist{$GLOBALS['OUTPUT']->ses}'");
			$recreate_button = tpl_form::button($GLOBALS['LANG']->lang_roommgmt->create_another_room,"document.location='./index.php?act=create_room&{$GLOBALS['OUTPUT']->ses}'");
			
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				<<<EOF
<script language='javascript' type='text/javascript'>
	joinButtonLabel = '{$GLOBALS['LANG']->lang_roommgmt->join_room}';

	function joinRoom(){
		window.parent.justCreated[{$rid}] = true;
		window.parent.addTab({$rid},1,'{$name}');
		document.location = './index.php?act=roomlist{$GLOBALS['OUTPUT']->ses}';
	}
	
	secsLeft = 30;
	function updateInterval(){
		if(secsLeft == 0){
			clearInterval(autoAction);
			joinRoom();
		}else{
			document.getElementById('joinroom').value = joinButtonLabel + ' (' + --secsLeft + ')';
		}
	}
	
	window.onload = function(){
		updateInterval();
		autoAction = setInterval("updateInterval();",'1000');
	}
</script>
<div style='width: 400px; margin: auto;'>
	<div class='form_container'>
		<div class='row title'>{$GLOBALS['LANG']->lang_formcommon->information}</div>
		<div class='row even'>{$GLOBALS['LANG']->lang_roommgmt->room_created_msg}</div>
		<div class='row end'>{$join_button} {$recreate_button} {$roomlist_button}</div>
</div>
EOF
.
			tpl_globals::footer();
		}
		
	}

?>